﻿using System;
using System.Collections.Generic;
using BLL;
using CrystalDecisions.CrystalReports.Engine;
using Model;

public partial class ProductManage_RFProductManage_Export_ProductTypeExport : System.Web.UI.Page
{
    private ReportDocument doc = new ReportDocument();

    protected void Page_Load(object sender, EventArgs e)
    {
        this.Page.Unload += new EventHandler(Page_Unload);
    }

    public IList<ProductTypeInfo> GetData()
    {
        IList<ProductTypeInfo> pts = new List<ProductTypeInfo>();
        ProductType pt = new ProductType();
        pts = pt.LoadEntities();
        return pts;
    }

    protected void CrystalReportViewer1_Init(object sender, EventArgs e)
    {
        ForCrystalReport();
    }

    protected void ForCrystalReport()
    {
        doc.Load(Server.MapPath("ProductType.rpt"));

        IList<ProductTypeInfo> list = GetData();
        doc.SetDataSource(list);
        this.CrystalReportViewer1.ReportSource = doc;
    }

    private void Page_Unload(object sender, EventArgs e)
    {
        doc.Dispose();
    }
}
